
const protecteds = Symbol()

class Common {
   constructor() {
    this[protecteds] = {}
    this[protecteds].host = "https://houdunren.com"
   }

  set host(url) {
    if (!/^https:\/\//i.test(url)) {
      throw new Error("网址错误");
    }
    this[protecteds].host = url;
  }

  get host() {
    return this[protecteds].host
  }

}

class Article extends Common {
  lists() {
    return `${this[protecteds].host}/article`;
  }
}
let article = new Article();
console.log(article.lists()); //https://houdunren.com/article
article.host = "https://hdcms.com";
console.log(article.lists()); //https://hdcms.com/article

console.log('-----------------------\n')
console.log(article)
article._host = 'aaaa'
// article.host = 'aaaa'
console.log(article.lists()); //https://hdcms.com/article
console.log(article[protecteds])


